<template>
  <view class="content">
    <image class="layoutView" :src="getImageUrl('bg.jpg')" mode="aspectFill"></image>
    <u-navbar height="50" :is-back="false" background="#2688C7" :border-bottom="false" />
    <view class="top-bar">
      <view class="bar-left"> </view>
      <view class="bar-right">
        <!-- <view class="msg-area" @click="routeToMsg">
					<u-icon :name="getImageUrl('zx')" size="48"></u-icon>
					<u-badge size="mini" :count="7" :offset="[-10,-12]" type="error"></u-badge>
				</view> -->
        <u-icon @click="onSetting" name="/static/img/sz.png" size="50"></u-icon>
      </view>
    </view>
    <view class="contentView">
      <view class="userView" v-if="userInfo">
        <u-avatar :src="userInfo.avatar_url" size="120" mode="circle"></u-avatar>
        <view class="userInfo">
          <view class="username">{{ userInfo.name || '用户昵称' }}</view>
          <view style="display: flex">
            <view class="userType" style="background-color: #e6f0f5; color: #008ed6">施工队</view>
            <view class="userType" style="background-color: #8cc340">已实名</view>
          </view>
        </view>
      </view>
      <view class="userView" v-else @click="onLogin()">
        <u-avatar size="120" mode="circle"></u-avatar>
        <view class="userInfo">
          <view class="logoBtn">还未登录账号</view>
          <text class="logo-btn"> 立即登录 </text>
        </view>
      </view>

      <view class="orderView">
        <view class="orderTab" @click="onGoodsOrder(0)">
          <view class="activeTab">接单管理</view>
          <view class="otherText">
            <text style="margin-right: 8rpx">更多</text>
            <u-icon name="/static/more.png" size="14"></u-icon>
          </view>
        </view>
        <view class="tabItemView">
          <!-- <view class="tabItem" @click="onGoodsOrder(1)">
						<text style="font-size: 34rpx;">{{}}</text>
						<view class="tabTitle">待付款</view>
					</view> -->
          <view class="tabItem" @click="onGoodsOrder(1)">
            <text style="font-size: 34rpx">{{ userInfo.enrollCount }}</text>
            <view class="tabTitle">已报名</view>
          </view>
          <view class="tabItem" @click="onGoodsOrder(2)">
            <text style="font-size: 34rpx">4</text>
            <view class="tabTitle">待确认</view>
          </view>
          <view class="tabItem" @click="onGoodsOrder(3)">
            <text style="font-size: 34rpx">{{ userInfo.constructingCount }}</text>
            <view class="tabTitle">已磋商</view>
          </view>
          <view class="tabItem" @click="onGoodsOrder(4)">
            <text style="font-size: 34rpx">{{ userInfo.stopCount }}</text>
            <view class="tabTitle">已终结</view>
          </view>
        </view>
      </view>
    </view>

    <view class="view-box">
      <!-- <view class="view-item">
				<u-icon name="/static/img/yq@2x.png" size="50"></u-icon>
				<view class="title">
					邀请有奖
				</view>
				<u-icon name="/static/img/more.png" size="15"></u-icon>
			</view> -->
      <view
        class="view-item"
        @click="routeTo('/other_center/con-team-case-manage/con-team-case-manage')"
      >
        <u-icon :name="getImageUrl('algl.png')" size="50"></u-icon>
        <view class="title"> 案例管理 </view>
        <u-icon name="/static/img/more.png" size="15"></u-icon>
      </view>
      <view class="view-item" @click="routeTo('/other_center/con-team-comment/con-team-comment')">
        <u-icon :name="getImageUrl('pjgl.png')" size="50"></u-icon>
        <view class="title"> 评价管理 </view>
        <u-icon name="/static/img/more.png" size="15"></u-icon>
      </view>
    </view>

    <view class="view-box">
      <view
        class="view-item"
        @click="routeTo('/other_center/construction-team-setting/construction-team-setting')"
      >
        <u-icon name="/static/img/grzl@2x.png" size="50"></u-icon>
        <view class="title"> 个人资料 </view>
        <u-icon name="/static/img/more.png" size="15"></u-icon>
      </view>
      <view class="view-item">
        <u-icon :name="getImageUrl('lxkf.png')" size="50"></u-icon>
        <view class="title"> 联系客服 </view>
        <text style="color: #0f76bb">0851-85118018</text>
        <u-icon name="/static/img/more.png" size="15"></u-icon>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      centerStatus: 1,
      navBackground: {
        background: '#00000000'
      },
      userInfo: {},
      userCode: '',

      chartData: {},
      opts: {
        color: [
          '#1890FF',
          '#91CB74',
          '#FAC858',
          '#EE6666',
          '#73C0DE',
          '#3CA272',
          '#FC8452',
          '#9A60B4',
          '#ea7ccc'
        ],
        padding: [15, 15, 0, 15],
        enableScroll: false,
        legend: {},
        xAxis: {
          disableGrid: true
        },
        yAxis: {
          gridType: 'dash',
          dashLength: 2
        },
        extra: {
          area: {
            type: 'curve',
            opacity: 0.2,
            addLine: true,
            width: 2,
            gradient: true,
            activeType: 'hollow'
          }
        }
      }
    }
  },
  onLoad() {},
  onShow() {
    this.$u.get('/app-api/construction/resume/get').then((res) => {
      this.userInfo = res.data
    })
  },
  onShareAppMessage() {
    return {
      path: '/pages/index/index?pid=' + this.userCode
    }
  },
  onReady() {},
  methods: {
    initData() {},
    onLogin() {
      this.$utils.goToLogin()
    },
    onSetting() {
      this.$utils.route('/universal/setting/setting', false)
    },
    onGoodsOrder(index) {
      this.$utils.route({
        url: '/other_center/conruct-team-orders/conruct-team-orders',
        params: {
          index: index
        }
      })
    },
    onWallet() {
      this.$utils.route('/other/my-wallet/my-wallet', false)
    },
    onMyCoupon() {
      this.$utils.route('/other/my-coupon/my-coupon', false)
    },
    onMyIntegral() {
      this.$utils.route('/other/integral/integral', false)
    },
    onPathPage(index) {
      if (index == 6) {
        uni.makePhoneCall({
          phoneNumber: '0858-8685365566',
          fail(res) {
            uni.$u.toast(JSON.stringify(res, null, 2))
          }
        })
      }
      let path = this.menuList[index].path
      this.$utils.route(path, false)
    },
    routeTo(url) {
      this.$utils.route(url, false)
    },
    onMyResale() {
      uni.navigateTo({
        url: '/other/invite-reward/invite-reward?status=1'
      })
    },
    routeToMsg() {
      uni.navigateTo({
        url: '/other_center/mer-message/mer-message'
      })
    },
    routeTo(url) {
      uni.navigateTo({
        url
      })
    }
  }
}
</script>

<style>
@import url('../../pages/ucenter/ucenter.css');

page {
  background: #f5f5f5;
}

.view-box {
  padding: 20rpx;
}
.view-item {
  height: 100rpx;
  display: flex;
  align-items: center;
  background-color: #fff;
  padding: 0 20rpx;
}
.title {
  flex: 1;
  margin-left: 15rpx;
}
.tabTitle {
  color: #666666;
}
</style>
